package com.four.controller;

import com.four.entity.Section;
import com.four.service.SectionService;
import com.four.vo.Result;
import com.sun.prism.impl.Disposer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Description:
 * @author:LiWei
 * @date:2022年10月14日16:03
 */
@RestController
@RequestMapping("section")
public class SectionController {
    @Autowired
    private SectionService sectionService;
    @GetMapping("/checkSection")
    public Result checkSection(){
        return sectionService.selectAll();
    }

    @PostMapping("/add")
    public Result add(@RequestBody Section record){
       return sectionService.add(record);
    }

    @GetMapping("/delete")
    public Result delete( int id){
        return sectionService.delete(id);
    }

    @PostMapping("/update")
    public Result update(@RequestBody Section record){
        return sectionService.update(record);
    }

    @GetMapping("/getDetails")
    public Result getDetails(int sectionId){
        return sectionService.getDetails(sectionId);
    }

    @PostMapping("/updateStatus")
    public Result updateStatus(@RequestBody Section sectionId){
        return this.sectionService.updateStatus(sectionId);
    }
}
